package chapter13;

public class Parallelogram extends GeometricObject implements Comparable<Parallelogram>{
    private double high;
    private double parallelEdge;
    private double bevelEdge;

    public Parallelogram(double hige, double parallelEdge, double bevelEdge) {
        this.high = hige;
        this.parallelEdge = parallelEdge;
        this.bevelEdge = bevelEdge;
    }

    public Parallelogram(String color, boolean filled, double hige, double parallelEdge, double bevelEdge) {
        super(color, filled);
        this.high = hige;
        this.parallelEdge = parallelEdge;
        this.bevelEdge = bevelEdge;
    }

    public double getHige() {
        return high;
    }

    public void setHige(double hige) {
        this.high = hige;
    }

    public double getParallelEdge() {
        return parallelEdge;
    }

    public void setParallelEdge(double parallelEdge) {
        this.parallelEdge = parallelEdge;
    }

    public double getBevelEdge() {
        return bevelEdge;
    }

    public void setBevelEdge(double bevelEdge) {
        this.bevelEdge = bevelEdge;
    }

    @Override
    public String toString() {
        return "high=" + high +
                ", parallelEdge=" + parallelEdge +
                ", bevelEdge=" + bevelEdge +
                ", area=" + getArea() ;
    }

    @Override
    public double getArea() {
        return high*parallelEdge;
    }

    @Override
    public double getPerimeter() {
        return 2*(parallelEdge+bevelEdge);
    }

    @Override
    public int compareTo(Parallelogram o) {
        if (getArea() > o.getArea())
            return 1;
        else if (getArea() < o.getArea())
            return -1;
        else
            return 0;
    }
}
